package cn.lx.test;

import cn.lx.application.TestApplication;
import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.client.ClientConfig;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.test.JerseyTest;
import org.glassfish.jersey.test.TestProperties;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import javax.ws.rs.client.Client;
import javax.ws.rs.client.ClientBuilder;
import javax.ws.rs.client.Invocation;
import javax.ws.rs.client.WebTarget;
import javax.ws.rs.core.Application;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.net.URI;

/**
 * Created by Administrator on 2017/3/17.
 */
public class RestTest2 extends JerseyTest{
    @Override
    protected Application configure() {

        //日志增强，启用传输日志
        enable(TestProperties.LOG_TRAFFIC);
        enable(TestProperties.DUMP_ENTITY);

        return new TestApplication();
    }


    @Test
    public void test1(){
        WebTarget path = target("test/test1");
        Invocation.Builder request = path.request();
        Response response = request.get();
        System.out.println(response.readEntity(String.class));
    }

    @Test
    public void test2(){
        int  i = 10/0;
        WebTarget path = target("test/test2");
        Invocation.Builder request = path.request();
        Response response = request.get();
        System.out.println(response.readEntity(String.class));
    }
}

